<%@ page language="java" import="java.util.*, com.zjut.an.news.manager.*, com.zjut.an.news.dao.*, com.zjut.an.webclass.manager.*, com.zjut.an.webclass.dao.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,com.zjut.an.util.page.*,com.zjut.an.util.module.*,com.zjut.an.adplace.manager.*, com.zjut.an.ad.manager.*,com.zjut.an.adplace.dao.*, com.zjut.an.ad.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/web.css" rel="stylesheet" type="text/css" />
</head>
<%
HTMLCreat html = (HTMLCreat) SpringContextUtil.getBean("HTMLCreat");
AnNewsManager manager = (AnNewsManager) SpringContextUtil.getBean("AnNewsManager");
AnWebclassManager wcmanager = (AnWebclassManager) SpringContextUtil.getBean("AnWebclassManager");
AnAdplaceManager apmanager = (AnAdplaceManager) SpringContextUtil.getBean("AnAdplaceManager");
AnAdManager admanager = (AnAdManager) SpringContextUtil.getBean("AnAdManager");
PageNumber pagemanager = (PageNumber) SpringContextUtil.getBean("PageNumber");
int wcId = Integer.parseInt(request.getParameter("wcId"));
AnWebclass webclass = wcmanager.getData(wcId);
String pageNoString = request.getParameter("pageNumber");
int pageNo = 1;
if (pageNoString != null && pageNoString.trim().length() != 0) {
	pageNo = Integer.parseInt(pageNoString.trim());
}
String pageSizeString = request.getParameter("showItemNumber");
int pageSize = 12;
if (pageSizeString != null && pageSizeString.trim().length() != 0) {
	pageSize = Integer.parseInt(pageSizeString.trim());
}
PageModule module = null;
if (webclass.getWcParent()!=0) {
	module = manager.getPubDatasByWcId(pageNo,pageSize,"adddate","desc",webclass);
} else {
	module = manager.getPubDatasByTopWcId(pageNo,pageSize,"adddate","desc",webclass);
}



 %>
<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="index.jsp">首页</a></li>
    <li><a href="#"><%=webclass.getWcName() %></a></li>
    </ul>
    </div>
    <div class="formbody">
    
	    <div class="rightinfo">
		    
	    
<%
if (webclass.getWcShowtype().equals(Status.CLASSSHOWTYPE_PAGE.getStatus())) { ////////////////////单页面
	List list = module.getObjects();
	AnNews news = new AnNews();
	if (list.size()>0) {
		news = (AnNews)list.get(0);
		out.print("<script>window.location='zs_news.jsp?neId="+news.getNeId()+"';</script>");
		out.close();
		return;
	}
}else{ %>
<div class="formtitle"><span><%=webclass.getWcName() %></span></div>
		    <table class="tablelist">
		    	<thead>
		    	<tr>
		        <th>编号</th>
		        <th>标题</th>
		        <th>发布时间</th>
		        </tr>
		        </thead>
		        <tbody>
		        <%
		        List list = module.getObjects();
				for(int i=0; i<list.size(); i++) {
					AnNews news = (AnNews)list.get(i);
		         %>
		        <tr>
		        <td><%=news.getNeId() %></td>
		        <td><a href="<%=html.newslink(news) %>"><%=news.getTitle() %></a></td>
		        <td><%=news.getAdddate().toString().substring(0,10) %></td>
		        </tr> 
		        <%} %>  
		        </tbody>
		    </table>
		    
		   
		    
		    <%
		    out.println("<div class='pagin'>"+PageNumber.printPageNumber(pageNo,pageSize, module.getTotal(),"zs_newsclass.jsp?wcId="+ wcId + "&")+"</div>"); 
}
		     %>
	    
	
		    
	    </div>
    
    
    </div>


<script src="../plugins/assets/plugins/jquery-3.5.1.min.js" type="text/javascript"></script>  
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script> 

		<script type="text/javascript">
    
		$('.tablelist tbody tr:odd').addClass('odd');
		</script>
</body>

</html>
